Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers, Python objects, etc.). The axis labels are collectively referred to as the index.
documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html
In [1]:
import pandas as pd
import numpy as np
In [ ]:
my_simple_series = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
my_simple_series
In [3]:
my_simple_series.index
Out[3]:
In [ ]:
In [ ]:
Access a series like a NumPy array
In [ ]:
In [ ]:
my_dictionary = {'a' : 45., 'b' : -19.5, 'c' : 4444}
my_second_series = pd.Series(my_dictionary)
my_second_series
In [ ]:
Access a series like a dictionary
In [ ]:
note order in display; same as order in "index"
note NaN
In [ ]:
pd.Series(my_dictionary, index=['b', 'c', 'd', 'a'])
In [ ]:
In [ ]:
unknown = my_second_series.get('f')
type(unknown)
In [ ]:
pd.Series(5., index=['a', 'b', 'c', 'd', 'e'])